global.USER_GROUP_ID = 1;

HAS_ROLE = function(userGroupId, roleName){
	//from initial_load = global.roles
	//console.log(">>>>>>>USERGROUPID = " + userGroupId + " ROLENAME " + roleName + " ACCESS " );
	if(typeof global.roles[userGroupId] !== "undefined" && typeof global.roles[userGroupId][roleName] !== "undefined"){
	//	console.log("USERGROUPID = " + userGroupId + " ROLENAME " + roleName + " ACCESS " +  global.roles[userGroupId][roleName] );
		return (global.roles[userGroupId][roleName]);
	}
	return false;
}


testYohanTenma = function(){
	return "SAMPLE CALLED";
}


getAccessRights = function(userGroupId){
	if(typeof global.roles[userGroupId] !== "undefined" ){
		//console.log("USERGROUPID = " + userGroupId );
		return global.roles[userGroupId];
	}else{
		return {};
	}
	
}


noPermission = function(res){
	  //console.log("USER PERMISSION TO ACCESS URL....");
	  //res.render('index', { title: 'Express-sample' });
	
	  //if logged in
		//res.redirect("/no-permission?no-permission");
	  //else{
		// login
	
	res.render("no-permission", {
	});
       
}
